/**
* @author AlbertDarren
* @contact 2563491540@qq.com
*/
#include <cstdio>

using namespace std;

int main_31()
{
    int n;
    scanf("%d",&n);
    for (int i=1;i<=n ;++i )
    {
        for (int j=1;j<=(n-1) ;++j )
        {
            printf("%d ",j);
        }
        printf("%d\n",n);
    }
	return 0;
}
